package com.csce.domain.entity.exam;

import com.osce.common.annotation.Excel;
import com.osce.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.util.Comparator;
import java.util.List;

/**
 * 题目表对象 ex_question
 *
 * @author zzx
 * @since 2023-07-31
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@ToString
@EqualsAndHashCode(callSuper = true)
public class ExQuestion extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ApiModelProperty("${comment}")
    private Long id;

    /**
     * 主题
     */
    @Excel(name = "主题")
    @ApiModelProperty("主题")
    private Integer topic;

    /**
     * 科目
     */
    @Excel(name = "科目")
    @ApiModelProperty("科目")
    private Integer subject;

    /**
     * 内容
     */
    @Excel(name = "内容")
    @ApiModelProperty("内容")
    private String content;

    /**
     * 类型
     */
    @Excel(name = "类型")
    @ApiModelProperty("类型")
    private Integer type;

    /**
     * 说明
     */
    @Excel(name = "说明")
    @ApiModelProperty("说明")
    private String info;

    /**
     * 预留字段1
     */
    @Excel(name = "预留字段1")
    @ApiModelProperty("预留字段1")
    private String reservedOne;

    /**
     * 预留字段2
     */
    @Excel(name = "预留字段2")
    @ApiModelProperty("预留字段2")
    private String reservedTwo;

    /**
     * 题目选项表信息
     */
    private List<ExQuestinOption> exQuestinOptionList;

    public void setExQuestinOptionList(List<ExQuestinOption> exQuestinOptionList) {
        exQuestinOptionList.sort(Comparator.comparing(ExQuestinOption::getIndex));
        this.exQuestinOptionList = exQuestinOptionList;
    }
}
